/**
 * 
 */
package com.evolved.automata.experimental;

import java.io.BufferedReader;
import java.io.BufferedWriter;

/**
 * @author Andrew
 *
 */
public class SerializerTemplate implements Serializer {

	public enum LoadState
	{
		INITIAL,EXIT
	}
	
	
	public enum SaveState
	{
		INITIAL,EXIT
	}
	
	
	private LoadState j_CurrentState;
	
	/* 
	 * @see com.evolved.automata.experimental.Serializer#AddData(java.lang.String)
	 */
	private SerializerAdapter j_SerializerHelper;
	private String j_UniqueName;
	
	public SerializerTemplate()
	{
		j_SerializerHelper = new SerializerAdapter(this);
	}
	
	
	/* TODO: Set this to save the data.
	 */
	public void SaveData(BufferedWriter writer) {
		SaveState currentState=SaveState.INITIAL;
		// Must traverse save state machine in same basic order as load machine is expected to be traversed
		while (currentState!=SaveState.EXIT)
		{
			switch (currentState)
			{
				
			}
		}

	}
	
	
	/*
	 * Use this to load simple data values
	 */
	public void AddData(String dataLine) {
		// Must traverse load state machine in same basic order as data is saved in SaveData
		switch (j_CurrentState)
		{
			// Add load code
		}
	}

	

	
	
	/* 
	 * Use this to add Serializers
	 */
	public void AddData(Serializer object, String instanceId) {
		// Must traverse load state machine in same basic order as data is saved in SaveData
		switch (j_CurrentState)
		{
			// Add load code
		}
	}

	
	/* 
	 * TODO: Set this to the String value that will be used to create this object in the SerializerAdapter.GetSerializer() class 
	 */
	
	public String GetTypeName() {
		
		return null;
	}

	/* 
	 * @see com.evolved.automata.experimental.Serializer#PrepareSerialization()
	 */
	
	public void PrepareSerialization() {
		// TODO Uncomment the code below after the current state has been set to first load state  
		//j_CurrentState=
	}
	
	
	
	/* ********************
	 * Standard methods Below.  Use the following standard code snippets for this.
	 * ********************
	 */
	
	public void Load(BufferedReader reader)
	{
		j_SerializerHelper.Load(reader);
	}
	
	
	public void Load(String fileFullName)
	{
		j_SerializerHelper.Load(fileFullName);
		
	}



	public void Save(String fileFullName)
	{
		j_SerializerHelper.Save(fileFullName);
	}


	public  void Save(BufferedWriter writer)
	{
		j_SerializerHelper.Save(writer);
	}

	
	public void SetName(String uniqueName)
	{
		j_UniqueName=uniqueName;
		j_SerializerHelper.SetUniqueName(uniqueName);
	}

}
